import { defineStore } from "pinia";
import { IObject } from "@/types/interface";
import {setTheme} from '@/styles/setTheme.ts'

export const useAppStore = defineStore("useAppStore", {
    state: () => ({
        state: {
            collapse: false,//菜单展开折叠方向
            /*标签列表，默认显示首页*/    
            tagsLists: [{path: '/'}],
            activeModules: '',
            themeVal: 'light',
            themeColor: '#0052d9',
            permissionList: [],
            isRouterAlive: true,
            ActiveAliveList: [],
        } as IObject
    }),
    actions: {
        changeSetting(data: any){
            setTheme(data);
        },
        setVarStyle(key:string,value:any, dom:any=document.documentElement){
            dom.style.setProperty(key, value)
        }
    },
   /*  persist: {
        enabled: true, // 这个配置代表存储生效，而且是整个store都存储
    } */
})